import React from 'react'
import { TabBar } from 'antd-mobile';
import { Route, Redirect } from "react-router-dom";

import Index from "../index/index";
import Found from "../found";
import My from "../my";

class Home extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            hidden: false,
            fullScreen: true,
        };
    }

    renderContent(pageText) {
        return (
            <div>{pageText}</div>
        )
    }

    render() {
        return (
            <div style={{ position: 'fixed', height: '100%', width: '100%', top: 0 }}>
                <Route path="/home"><Redirect to="/home/index"></Redirect> </Route>
                <TabBar
                    unselectedTintColor="#949494"
                    tintColor="#108ee9"
                    barTintColor="white"
                >
                    <TabBar.Item
                        title="首页"
                        key="index"
                        icon={<i className="iconfont icon-ind" />}
                        selectedIcon={<i className="iconfont icon-ind" />}
                        selected={this.props.location.pathname === "/home/index"}
                        badge={10}
                        onPress={() => {
                            this.props.history.push("/home/index")
                        }}
                    >
                        <Route path="/home/index" component={Index}></Route>
                    </TabBar.Item>
                    <TabBar.Item
                        icon={<i className="iconfont icon-findHouse" />}
                        selectedIcon={<i className="iconfont icon-findHouse" />}
                        title="找房"
                        key="found"
                        selected={this.props.location.pathname === "/home/found"}
                        onPress={() => {
                            this.props.history.push("/home/found")
                        }}
                    >
                        <Route path="/home/found" component={Found}></Route>
                    </TabBar.Item>
                    <TabBar.Item
                        icon={<i className="iconfont icon-my" />}
                        selectedIcon={<i className="iconfont icon-my" />}
                        title="我的"
                        key="my"
                        selected={this.props.location.pathname === "/home/my"}
                        onPress={() => {
                            this.props.history.push("/home/my")
                        }}
                    >
                        <Route path="/home/my" component={My}></Route>
                    </TabBar.Item>
                </TabBar>
            </div >
        );
    }
}

export default Home;

